<!DOCTYPE html>

<html class="no-js">

<head>
  <meta charset="utf-8" />
  <meta http-equiv="X-UA-Compatible" content="IE=edge" />
  <title></title>
  <meta name="description" content="" />
  <meta name="viewport" content="width=device-width, initial-scale=1" />
  <script src="https://cdn.staticfile.org/axios/0.19.0-beta.1/axios.js"></script>
  <script src="../../cdn/vue/vue.global.min.js"></script>
  <link rel="stylesheet" href="../../cdn/element-plus/index.css" />
  <script src="../../cdn/element-plus/index.full.min.js"></script>
  <link rel="stylesheet" href="https://cdn.staticfile.org/animate.css/3.7.0/animate.min.css" />
  <link rel="stylesheet" href="../../../lib/index.css" />
  <script src="../../../lib/avue.js"></script>
</head>

<body>
  <div id="app">
    <ul>
      <li v-for="(item,index) in list" :key="index" class="el-dropdown-menu__item"
        v-contextmenu="{id:'dialog',event:handleEvent,value:item,hide:handleHide}">
        {{item.name}}
      </li>
    </ul>
    <ul class="el-dropdown-menu el-popper is-light" id="dialog">
      <li class="el-dropdown-menu__item" @click="handleClick1">
        <i class="el-icon-eleme"></i>菜单1
      </li>
      <li class="el-dropdown-menu__item" @click="handleClick2">
        <i class="el-icon-user"></i>菜单2
      </li>
      <li class="el-dropdown-menu__item" @click="handleClick3">
        <i class="el-icon-goods"></i>菜单3
      </li>
      <li class="el-dropdown-menu__item el-dropdown-menu__item--divided" @click="handleClick4">
        <i class="el-icon-circle-check"></i>菜单4
      </li>
      <li class="el-dropdown-menu__item" @click="handleClick4">
        菜单5
      </li>
    </ul>
  </div>
</body>

</html>

<script>
  let app = Vue.createApp({
    data () {
      return {
        form: {},
        list: [{
          name: '张三'
        }, {
          name: '李四'
        }, {
          name: '王五'
        }]
      }
    },
    created () {
    },
    methods: {
      handleHide (row, e) {
        this.$message.success('隐藏回调' + JSON.stringify(row))
      },
      handleEvent (row, done, e) {
        this.form = row;
        done();
        this.$message.success('回调信息' + JSON.stringify(row))
      },
      handleClick1 () {
        this.$message.success('菜单1' + JSON.stringify(this.form))
        this.list.splice(1, 1)
      },
      handleClick2 () {
        this.$message.success('菜单2' + JSON.stringify(this.form))
      },
      handleClick3 () {
        this.$message.success('菜单3' + JSON.stringify(this.form))
      },
      handleClick4 () {
        this.$message.success('菜单4' + JSON.stringify(this.form))
      },
    }
  })
  app.use(ElementPlus)
  app.use(AVUE)
  app.mount('#app')
</script>